<template>
  <div class="cesium-child">
    <el-button>创建</el-button>
  </div>
</template>

<script lang="ts">
export default {
  name: "createEntity",
};
</script>

<script lang="ts" setup>
import {
  createEntitySource,
  getEntitySource,
  onDoubleClick,
  createViewer,
  onLeftClick,
  PositionEventType,
  createEntity,
} from "yt-cesium";
import { Cartesian3, Color } from "cesium";

const { source, mount } = createEntitySource("pointEntity");

source.entities.add({
  point: {
    pixelSize: 10,
    color: Color.RED,
  },
  position: Cartesian3.fromDegrees(120, 32, 0),
});

mount();

createEntity(
  {
    position: Cartesian3.fromDegrees(120, 31, 0),
    point: {
      pixelSize: 10,
      color: Color.WHITE,
    },
  },
  source.entities
);

onDoubleClick(
  (e: unknown) => {
    console.log(e);
    console.log(getEntitySource("pointEntity"));
  },
  {
    isEntity: true,
  }
);
//
// onLeftClick((e: any) => {
//   console.log(e)
// }, {isEntity: true})
</script>

<style scoped></style>
